import request from '@/utils/request'

// api地址
const api = {
  recommends: '/mxty/course/recommends',
  list: '/mxty/course/list',
  detail: '/mxty/course/detail',
  userCourse: '/mxty/course/userCourse',
  coachCourse: '/mxty/course/coachCourse',
  buy: '/mxty/course/buy',
  getCodeToken: '/mxty/course/getCodeToken',
  checkCourse: '/mxty/course/checkCourse',
  clockIn: '/mxty/course/clockIn',
  lessons: '/mxty/course/lessons',
}

// 获取推荐的课程
export const recommends = (param) => {
  return request.get(api.recommends, param)
}

// 获取所有课程
export const list = (param) => {
  return request.get(api.list, param)
}

// 获取指定课程的详情
export const detail = (param) => {
  return request.get(api.detail, param)
}

// 获取会员用户的所有课程
export const userCourse = (param) => {
  return request.get(api.userCourse, param)
}

// 获取教练的所有课程
export const coachCourse = (param) => {
  return request.get(api.coachCourse, param)
}

// 购买课程
export const buy = (param) => {
  return request.get(api.buy, param)
}

// 获取课程二维码token
export const getCodeToken = (param) => {
  return request.get(api.getCodeToken, param)
}

// 获取课程二维码信息
export const checkCourse = (param) => {
  return request.get(api.checkCourse, param)
}

// 课程二维码签到
export const clockIn = (param) => {
  return request.get(api.clockIn, param)
}

// 所有指定课程的所有课时
export const lessons = (param) => {
  return request.get(api.lessons, param)
}
